package com.design.patterns.proxy;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 *
 * @author wangxc
 * @date: 2019-10-23 23:19
 *
 */
public class Reflect {
	public static void main(String[] args) {
		Fruit fruit = (Fruit) Dynamic.agent(Fruit.class, new Apple());
		fruit.smell();

		try {
			Method method = Apple.class.getMethod("smell");
			method.invoke(new Apple());
		} catch (NoSuchMethodException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
	}
}
